#ifndef LIDAR_CELL_OBJS_TYPE_H
#define LIDAR_CELL_OBJS_TYPE_H
#include "lidar_cell_type.h"
#include "lidar_points_type.h"
#include <cstdint>
#include <math.h>
#include <vector>
namespace perception
{
    namespace algorithm
    {
        // struct dbscan_config
        // {
        //     float z_eps;
        //     int min_points_num;
        //     int search_scope;
        // };
        constexpr double deg2rad = M_PI / 180.0;
        constexpr double rad2deg = 180.0 / M_PI;
        struct cluster_id
        {
            int grid_num;
            int state;    // 初始值-2 ，-1为核心点，>-1为聚类id
            bool is_used; // false -未聚类，true已经聚类
        };
        struct cord
        {
            int x;
            int y;
        };
        struct CornerPoint
        {
            float x;
            float y;
        };
        enum ObjectType
        {
            CAR = 0,        // 1
            TRUCK = 1,      // 2
            PEDESTRIAN = 2, // 4
            CYCLIST = 3,    // 3 5
            VIRTUAL = 4,    //
            UNKNOWN = 5,    // 0
            HANGING = 6,
            TINY = 7,
            NOISE = 8,
            SHORT_LOW = 9,
            COUNT = 10,
        };
        struct LidarObject
        {

            int id;
            float z_min;
            float z_max;
            // TODO:
            float z_ground; // get z ground valud from plane fitting
            float density;
            float intensity;
            float x;
            float y;
            float z;
            float xabs;
            float yabs;
            float vx;
            float vy;
            float vxabs;
            float vyabs;
            float angular_vz;
            float speed;
            float width;
            float height;
            float length;
            // float roll;
            float heading;
            float confidence;
            uint8_t type;
            uint8_t dynamic_status;
            bool moveable;
            bool has_position_covariance = false;
            size_t frame;
            size_t age;
            // l-shape
            CornerPoint corner_point;
            float l1;
            float l2;
            float thetal1;
            float thetal2;
            std::vector<data_cell> cells;
            std::vector<CornerPoint> corner_points;
            pcl::PointCloud<pcl::PointXYZI> cluster_points;

            // track
            std::array<double, 36> pose_cov;
            std::array<double, 36> twist_cov;
        };
    } // lidar_cells
} // perception

#endif